<?php

declare(strict_types=1);

namespace App\Request\Auth;

use Hyperf\Validation\Request\FormRequest;

class UserRegisterRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'account' =>'required',
            'password' =>'required',
            'company_name' =>'nullable',
            'share_code' =>'nullable',
            'code_type' =>'nullable|in:1,2',
            'verification_code' =>'required',
            'phone' =>'required',
            're_password' =>'required|same:password',
        ];
    }


    public function messages(): array
    {
        return [
            'company_name.required' => '公司名称',
            'account.required' => '账号必须存在',
            'phone.required' => '手机号必须存在',
            'password.required' => '密码必须填写',
            're_password.required' => '验证密码不存在',
            're_password.same' => '两次输入的密码不相等',
            'verification_code.required' => '验证码必须存在'

        ];
    }
}
